package database;

import java.util.*;

/**
 * Description: collection util
 * Created by 4790K_NSL on 2017/5/4.
 */
public class UtilConnection {
    static public Collection copyEmptyCollection(Collection src){
        int size=src.size();
        if(src instanceof ArrayList){
            return new ArrayList(size);
        }

        if(src instanceof LinkedList){
            return new LinkedList();
        }

        if(src instanceof HashSet){
            return new HashSet(size);
        }

        if(src instanceof TreeSet){
            return new TreeSet();
        }

       throw new RuntimeException("Collection is not supported.");
    }
}
